<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/vue.js"></script>
    <script src="js/jquery.js"></script>
</head>
<body>
<div id="app">
    <a href="add.html">新增</a>
    <ul>
        <li v-for="item in brands">
            {{item.id}}--{{item.name}}--{{item.code}}
            <a :href="'detail.html?id='+item.id">编辑</a>
            <button @click="remote2(item.id)">删除</button>
        </li>
    </ul>
</div>

<script>
    var vue = new Vue({
        el:'#app',
        data:{
            brands:[]
        },
        methods:{
            remote2:function (id) {
               $.ajax({
                   url:"http://localhost:8080/brand/delete",
                    type:'DELETE',
                   data:{id: id},//参数
                    success:function () {
                        location.href="index.html";
                    }
                })
            }
        },
        mounted:function () {
            //_this=this
              $.get('http://localhost:8080/brand/list',{},function (data) {
                  vue.brands=data.data.records;
              });
        }

    })
</script>
</body>
</html>